package games.gong.durid.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 添加对 favicon.ico 的处理，避免 NoResourceFoundException 错误
        registry.addResourceHandler("/favicon.ico")
                .addResourceLocations("classpath:/static/favicon.ico")
                .setCachePeriod(3600);
                
        // 确保其他静态资源可以正常访问
        registry.addResourceHandler("/static/**")
                .addResourceLocations("classpath:/static/");
    }
}